package com.rbcs.repay.service;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.rbcs.repay.model.RePay;
import com.systop.core.ApplicationException;
import com.systop.core.service.BaseGenericsManager;

/**
 * 还款申请管理Manager
 * 
 * @author ShangHua
 */
@Service
public class RePayManager extends BaseGenericsManager<RePay> {
	
	/**
	 * 保存还款申请信息
	 */
	@Override
	@Transactional
	public void save(RePay rePay) {
		if (getDao().exists(rePay, "singleNo")) {
			if (StringUtils.isNotEmpty(rePay.getSingleNo())) {
				throw new ApplicationException("还款单号为【" + rePay.getSingleNo() + "】的还款单已存在。");
			}
		}
		try {
			// 保存还款申请表
			super.save(rePay);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
